package com.gdsdxy.bookshop.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gdsdxy.bookshop.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {
    //查看全部用户
    List<User> queryUserList();
    ////添加用户数据
    int addUser(User user);
    //删除用户
    int delUser(long userId);
    //更新用户
    int updateUser(User user);
    //用户登录
    User selectByUnameAndPwd(@Param("userName") String userName, @Param("password") String password);
    //用户状态查询
    User selectByUnameAndPwdAndState(@Param("userName") String userName, @Param("password") String password,@Param("state") Integer state);

    /**
     * 根据用户的id来修改密码
     * @param useid       用户id
     * @param password     用户输入的新密码
     * @return 返回值影响的行数
     */
    Integer updatePasswordByUserId(Integer useid, String password);

}
